<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="th/m/include/head :: head(~{::title}, ~{::style})">
    <meta charset="utf-8">
    <title>图片签名框</title>
    <style></style>
</head>
<body>
<header class="mui-bar mui-bar-nav">
    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
    <h1 class="mui-title">
        签名框
    </h1>
</header>
<div class="mui-content">
    <div class="mui-input-row mui-select">
        <label style="color: #000;">
            印章
        </label>
        <select id="stampId" name="stampId">
            <option value="">无</option>
            <option th:each="stamp, stat : ${stamps}" th:value="${stamp.id}" th:attr="link=${stamp.imageUrl}">[[${stamp.title}]]</option>
        </select>
    </div>
    <div class="mui-input-row">
        <label style="color: #000;">
            密码
        </label>
        <input type="password" class="mui-input-clear" id="pwd" placeholder="请输入密码">
    </div>
    <div class="mui-button-row">
        <button class="mui-btn mui-btn-primary" type="button" onclick="return false;">签名</button>
    </div>
</div>
<script type="text/javascript" th:src="@{/weixin/js/macro/macro.js}"></script>
<script th:inline="javascript">
    function comparePwd() {
        var realName = [[${realName}]];
        var pwd = [[${pwd}]];
        var code = [[${code}]];
        var _curPwd = jQuery("#pwd").val();
        if(pwd != _curPwd){
            // $.toast("密码不一致!");
            mui.alert('密码错误！', '提示', function() {});
            return false;
        }
        return true;
    }

    (function($) {
        $.init({
            swipeBack:true //启用右滑关闭功能
        });
        $(".mui-content").on("tap",".mui-btn",function(){
            if (comparePwd()) {
                var link = jQuery("#stampId option:selected").attr("link");
                window.parent.closeSignInImg([[${code}]], jQuery('#stampId').val(), link);
            }
        });
    })(mui);
</script>
</body>
</html>